package realQuestion.xima;

public class Main2 {

    public int removeDuplicates (int[] nums) {
        // write code here

        if (nums.length==0||nums==null){
            return 0;
        }

        if (nums.length==1){
            return  1;
        }
        int len=0;
        nums[len]=nums[0];
        for (int i = 1; i < nums.length ; i++) {

            if (nums[i]==nums[len]){
                continue;
            }else {
                len+=1;
                nums[len]=nums[i];
            }

        }
        return  len+1;

    }
}
